package com.college_career_system.handler;

import com.alibaba.fastjson.JSONObject;
import com.college_career_system.utils.ResponseCode;
import com.college_career_system.utils.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.security.SignatureException;

/**
 * @Author: Empty
 * @Date: 2022-12-06-20:40
 * @Description:
 */
@RestControllerAdvice
public class PermissionHandler {

    @ExceptionHandler(value = { RuntimeException.class })
    @ResponseBody
    public JSONObject authorizationException(RuntimeException e){
        return ResponseResult.failure(e.getMessage(),null, ResponseCode.STATUS_NOT_LOGGED_IN);
    }
}